﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;
using Kokomo.Mirror.CliMetadata;
using Kokomo.Environment;
using Kokomo.Environment.Documents;

namespace Kokomo.PeInspector
{
	[ViewType(typeof(TableView))]
	class TableViewModel : DetailViewModel
	{
		public object Table { get; private set; }

		public TableViewModel(
			NavigationContext navigationContext,
			UiString tableName,
			object table
			)
			: base(navigationContext, null, tableName)
		{
			if (table == null) throw new ArgumentNullException("table");
			this.Table = table;
			this.TableName = tableName;

			IList list = table as IList;
			if (list != null)
			{
				this.Summary.Details.Add(new SummaryDetailItem(
					UiString.FromString(Messages.RowCountLabel),
					UiString.FromString(list.Count.ToString())
					));
			}
		}

		public string TableName { get; private set; }
	}
}
